<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员注册</title>
    <script src="/js/vue.global.js"></script>
    <script src="/js/axios.min.js"></script>
</head>
<body id="app">
<h3>管理员注册</h3>

邮箱：<input type="text" id="email" name="email"> <br/>
密码：<input type="text" id="password" name="password"> <br/>
昵称：<input type="text" id="name" name="name"> <br/>
电话：<input type="text" id="telephone" name="telephone"> <br/>
<button v-on:click="this.adminregistration()">注册</button>

<script>
    //定义app
    const app = {

        //数据绑定
        data() {
            return {}
        },
        //事件绑定
        methods: {
            //用户注册
            adminregistration: function () {
                axios({
                    method: "post", url: "/adminregistration", data: {
                        email: document.getElementById("email").value,
                        password: document.getElementById("password").value,
                        name: document.getElementById("name").value,
                        telephone: document.getElementById("telephone").value,
                    }
                }).then((response) => {
                    if (response.data === 'ok') {
                        alert("注册成功！")
                    } else {
                        alert(response.data)
                    }

                });
            }
        },

        //构造方法
        mounted() {
            console.log("vue启动成功！")
        }
    }

    //启动app
    Vue.createApp(app).mount("#app")
</script>
</body>
</html>